[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1 Frames and X Windows

When using the X Window System, you can create multiple windows at the X level in a single Emacs session. Each X window that belongs to Emacs displays a frame which can contain one or several Emacs windows. A frame initially contains a single general-purpose Emacs window which you can subdivide vertically or horizontally into smaller windows. A frame normally contains its own echo area and minibuffer, but you can make frames that don’t have these—they use the echo area and minibuffer of another frame.

Anything you do in one frame also affects the other frames. For instance, if you put text in the kill ring in one frame, you can yank it in another frame. If you exit emacs through C-x C-c in one frame, it terminates all the frames. To delete just one frame, use C-x 5 0.

To avoid confusion, we reserve the word “window” for the subdivisions that Emacs implements, and never use it to refer to a frame.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1 Mouse Commands

mouse-1

Move point to where you click (mouse-set-point). This is normally the left button.

drag-mouse-1

Move point to where you release the mouse, and set the mark where you initially clicked the mouse (mouse-set-region). Thus, you can specify both ends of the region.

mouse-2

Yank the last kill text, where you click (mouse-yank-at-click). This is normally the middle button.

mouse-3

Copy text to the kill ring (mouse-save-then-click). This is normally the right button. If you click it a second time at the same place, that kills the text.

This operation applies to the text between point and the place where you click.

Thus, to kill a section of text, you can press <Mouse-1> at one end, then press <Mouse-3> twice at the other end. To select the text for copying without deleting it from the buffer, press <Mouse-3> just once. Then you can copy it elsewhere by yanking it. @xref{Killing}.

To yank the killed or copied text somewhere else, move the mouse there and press <Mouse-2>. @xref{Yanking}.

To copy text to another X window, kill it or save it in the kill ring. Under X, this also sets the primary selection. Then use the “paste” or “yank” command of the program operating the other window to insert the text from the selection.

To copy text from another X window, use the “cut” or “copy” command of the program operating the other window, to select the text you want. Then yank it in Emacs with C-y or <Mouse-2>.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2 Creating Frames

The prefix key C-x 5 is analogous to C-x 4, with parallel subcommands. The difference is that C-x 5 commands create a new frame rather than just a new window in the selected frame. (@xref{Pop Up Window}.) Different C-x 4 commands have different ways of finding the buffer to select.

C-x 5 b bufname <RET>

Select buffer bufname in another window. This runs
switch-to-buffer-other-frame.

C-x 5 f filename <RET>

Visit file filename and select its buffer in another frame. This runs find-file-other-frame. @xref{Visiting}.

C-x 5 d directory <RET>

Select a Dired buffer for directory directory in another frame. This runs dired-other-frame. @xref{Dired}.

C-x 5 m

Start composing a mail message in another frame. This runs mail-other-frame, and its same-frame version is C-x m. @xref{Sending Mail}.

C-x 5 .

Find a tag in the current tag table in another frame. This runs find-tag-other-frame, the multiple-frame variant of M-.. @xref{Tags}.

C-x 5 r filename <RET>

Visit file filename read-only, and select its buffer in another frame. This runs find-file-read-only-other-frame. @xref{Visiting}.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.3 Setting Frame Parameters

This section describes commands for altering the display style and window management behavior of the selected frame.

M-x set-foreground-color <RET> color <RET>

Specify color color for the foreground of the selected frame.

M-x set-background-color <RET> color <RET>

Specify color color for the background of the selected frame.

M-x set-cursor-color <RET> color <RET>

Specify color color for the cursor of the selected frame.

M-x set-mouse-color <RET> color <RET>

Specify color color for the mouse cursor when it is over the selected frame.

M-x set-border-color <RET> color <RET>

Specify color color for the border of the selected frame.

M-x auto-raise-mode

Toggle whether or not the selected frame should auto-raise. Auto-raise means that every time you move the mouse onto the frame, it raises the frame.

M-x auto-lower-mode

Toggle whether or not the selected frame should auto-lower. Auto-lower means that every time you move the mouse off of the frame, the frame moves to the bottom of the stack of X windows.

M-x set-default-font <RET> font <RET>

Specify font font as the default for the selected frame. @xref{Font X}, for ways to list the available fonts on your system.

You can also set a frame’s default font through a pop-up menu. Press C-<Mouse-3> to activate this menu.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.4 Scroll Bars

When using X, Emacs normally makes a scroll bar at the right of each Emacs window. The scroll bar runs the height of the window, and shows a moving rectangular inner box which represents the portion of the buffer currently displayed. The entire height of the scroll bar represents the entire length of the buffer.

You can use <Mouse-2> (normally, the middle button) in the scroll bar to move or drag the inner box up and down. If you move it to the top of the scroll bar, you see the top of the buffer. If you move it to the bottom of the scroll bar, you see the bottom of the buffer.

The left and right buttons in the scroll bar scroll by controlled increments. <Mouse-1> (normally, the left button) moves the line at the level where you click up to the top of the window. <Mouse-3> (normally, the right button) moves the line at the top of the window down to the level where you click. By clicking repeatedly in the same place, you can scroll by the same distance over and over.

You can enable or disable Scroll Bar mode with the command M-x scroll-bar-mode. With no argument, it toggles the use of scroll bars. With an argument, it turns use of scroll bars on if and only if the argument is positive. This command applies to all frames, including frames yet to be created.

To enable or disable scroll bars for just the selected frame, use the M-x toggle-scroll-bar command.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.5 Menu Bars

By default, each Emacs frame has a menu bar at the top which you can use to perform certain common operations. There’s no need to describe them in detail here, as you can more easily see for yourself; also, we may change them and add to them in subsequent Emacs versions.

Each of the operations in the menu bar is bound to an ordinary Emacs command which you can invoke equally well with M-x or with its own key bindings. To see the command’s name and documentation, type C-h k and then select the menu bar item you are interested in.

You can turn display of menu bars on or off with M-x menu-bar-mode. With no argument, this command toggles Menu Bar mode, a minor mode. With an argument, the command turns Menu Bar mode on if the argument is positive, off if the argument is not positive.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.6 Using Multiple Typefaces

When using Emacs with X, you can set up multiple styles of displaying characters. The aspects of style that you can control are the type font, the foreground color, the background color, and whether to underline.

The way you control display style is by defining named faces. Each face can specify a type font, a foreground color, a background color, and an underline flag; but it does not have to specify all of them.

The style of display used for a given character in the text is determined by combining several faces. Which faces to use is always set up by Lisp programs, at present, by means of text properties and overlays. Any aspect of the display style that isn’t specified by overlays or text properties comes from the frame itself.

When Transient Mark mode is enabled, the text of the region is highlighted when the mark is active. This uses a face named region; you can control the style of highlighting by changing the style of this face with the commands below. @xref{Setting Mark}, for more information about Transient Mark mode and activation and deactivation of the mark.

Here are the commands for users to change the font of a face.

M-x set-face-font <RET> face <RET> font <RET>

Use font font in face face.

M-x make-face-bold <RET> face <RET>

Convert face face to use a bold version of its current font.

M-x make-face-italic <RET> face <RET>

Convert face face to use a italic version of its current font.

M-x make-face-bold-italic <RET> face <RET>

Convert face face to use a bold-italic version of its current font.

M-x make-face-unbold <RET> face <RET>

Convert face face to use a non-bold version of its current font.

M-x make-face-unitalic <RET> face <RET>

Convert face face to use a non-italic version of its current font.

Here are the commands for users to set the colors and underline flag of a face:

M-x set-face-foreground <RET> face <RET> color <RET>

Use color color for the foreground of characters in face face.

M-x set-face-background <RET> face <RET> color <RET>

Use color color for the background of characters in face face.

M-x set-face-underline-p <RET> face <RET> flag <RET>

Specify whether to underline characters in face face.

M-x invert-face <RET> face <RET>

Swap the foreground and background colors of face face.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.7 Miscellaneous X Window Features

To iconify the selected Emacs frame, type C-z. The normal meaning of C-z, to suspend Emacs, is not useful under a window system, so it has a different binding in that case (the command iconify-frame).

To delete the selected frame, type C-x 5 0.

Under X Windows, when Transient Mark mode is enabled, Emacs highlights the region when the mark is active. This is the main motive for using Transient Mark mode. To enable this mode, use the command M-x transient-mark-mode. @xref{Mark}.


[Top] [Contents] [Index] [ ? ]

About This Document

This document was generated on March 29, 2022 using texi2html 5.0.

The buttons in the navigation panels have the following meaning:

Button Name Go to From 1.2.3 go to
[ << ] FastBack Beginning of this chapter or previous chapter 1
[ < ] Back Previous section in reading order 1.2.2
[ Up ] Up Up section 1.2
[ > ] Forward Next section in reading order 1.2.4
[ >> ] FastForward Next chapter 2
[Top] Top Cover (top) of document  
[Contents] Contents Table of contents  
[Index] Index Index  
[ ? ] About About (help)  

where the Example assumes that the current position is at Subsubsection One-Two-Three of a document of the following structure:


This document was generated on March 29, 2022 using texi2html 5.0.